<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0">
    <title>商品审核 - 钢域云贸</title>
    <link rel="icon" href="/uploads/logo.png" type="image/x-icon"/>
    <link rel="shortcut icon" href="/uploads/logo.png" type="image/x-icon"/>
    <link rel="stylesheet" href="/css/bootstrap.min.css" type="text/css" media="all"/>
    <link rel="stylesheet" type="text/css" href="/css/public.css"/>
    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100">
<!-- 公共头部 -->
<th:block th:replace="~{/header.html}"></th:block>

<!-- Main Content -->
<main class="container mx-auto my-8">
    <div class="bg-white p-6 rounded shadow">
        <h2 class="text-xl font-bold mb-4">商品信息</h2>
        <div class="grid grid-cols-2 gap-4 mb-6">
            <div>
                <label class="block text-gray-700">商品名称</label>
                <input th:value="${product.name}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">分类</label>
                <input th:value="${product.categoryName}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">价格</label>
                <input th:value="'¥' + ${#numbers.formatDecimal(product.price, 1, 2)}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">库存</label>
                <input th:value="${product.inventory}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">材质</label>
                <input th:value="${product.material}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">规格</label>
                <input th:value="${product.specification}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">供应商</label>
                <input th:value="${product.supplierName}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">发货地区</label>
                <input th:value="${product.shippingRegion}" readonly class="w-full border p-2 rounded bg-gray-100">
            </div>
            <div>
                <label class="block text-gray-700">材质报告</label>
                <a th:href="@{${product.materialReportUrl}}" class="text-blue-600 hover:text-blue-800" target="_blank">查看材质报告</a>
            </div>
        </div>

        <h2 class="text-xl font-bold mb-4">审核信息</h2>
        <form th:action="@{/manager/product/audit(id=${product.id})}" method="post">
            <input type="hidden" name="id" th:value="${product.id}">
            <div class="mb-4">
                <label class="block text-gray-700">审核状态</label>
                <!-- 状态下拉框 -->
                <select name="status" class="border border-gray-300 rounded-lg px-3 py-2 w-full focus:outline-none focus:ring-2 focus:ring-blue-300" required>
                    <option value="APPROVED">通过</option>
                    <option value="REJECTED">不通过</option>
                </select>
            </div>
            <div class="mb-4">
                <label class="block text-gray-700">审核意见</label>
                <textarea name="auditComment" class="w-full border p-2 rounded" rows="4"></textarea>
            </div>
            <!-- 操作按钮 -->
            <div class="flex justify-end space-x-4 mt-4">
                <a th:href="@{/manager/product}" class="bg-gray-300 text-gray-800 px-4 py-2 rounded-lg hover:bg-gray-400 transition">返回</a>
                <button type="submit" class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition">提交审核</button>
            </div>

        </form>
    </div>
</main>

<!-- 公共底部 -->
<th:block th:replace="~{/footer.html}"></th:block>
</body>
</html>